//
//  UITextField+Shark.m
//  面试例子
//
//  Created by song on 15/8/18.
//  Copyright (c) 2015年 song. All rights reserved.
//

#import "UITextField+Shark.h"
#import <QuartzCore/QuartzCore.h>


@implementation UITextField (Shark)


-(void)shark
{
    CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
     
    [animation setDuration:0.5];
    
    NSMutableArray *postionarray = [NSMutableArray array];
    NSMutableArray *timearray = [NSMutableArray array];
    for(int i = 0 ;i<3 ;i++)
    {
        [postionarray addObject:[NSValue valueWithCGPoint:CGPointMake(self.center.x, self.center.y)]];
        [postionarray addObject:[NSValue valueWithCGPoint:CGPointMake(self.center.x-5, self.center.y)]];
        [postionarray addObject:[NSValue valueWithCGPoint:CGPointMake(self.center.x+5,self.center.y)]];
    }
    [postionarray addObject:[NSValue valueWithCGPoint:CGPointMake(self.center.x,self.center.y)]];
    
    [animation setValues:postionarray];
    for(float f =0 ;f<1 ; f =f +0.1)
    {
        [timearray addObject:[NSNumber numberWithFloat:0.1f+f]];
    }
    [animation setKeyTimes:timearray];
    
    [self.layer addAnimation:animation forKey:@"TextAnim"];
    
    
    
}


@end
